//
//  SEHospitalListExamineCell.swift
//  SmartEyeForPatient
//
//  Created by qdsg on 2021/4/2.
//

import UIKit

class SEHospitalListExamineCell: UITableViewCell {

    static let className = "SEHospitalListExamineCell"
    static let reuseId = className

    @IBOutlet weak var hospitalNameLabel: UILabel!
    @IBOutlet weak var hospitalDistanceLabel: UILabel!
    @IBOutlet weak var hospitalAddressLabel: UILabel!
    @IBOutlet weak var collectionView: SETagsCollectionView! 

    @IBOutlet weak var collectionViewHeightConstraint: NSLayoutConstraint!

    func updateCell(model: SEHospitalListItem) {
        hospitalNameLabel.text = model.name
        hospitalAddressLabel.text = model.address
        hospitalDistanceLabel.text = model.distance
        collectionView.titles = model.itemList

        frame = UIScreen.main.bounds
        layoutIfNeeded()
        collectionView.reloadData()
        let contentSize = collectionView.collectionViewLayout.collectionViewContentSize
        collectionViewHeightConstraint.constant = contentSize.height
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
